<{include file="simple_header.tpl"}>
<div class="content" style="margin-top:40px;">
	<div class="siteintro">
        <div class="register">  
            <form action='/site/login' method='POST' id='loginForm'>      
            <div class="registertitle" style="margin-bottom:40px;">
            	登录
            </div> 
            <div class="shurukuang">
                <span>用户名：</span><input id='username' name='username' value="" class="input2">
                <div class="tips-line">
                	<div class="tip-tishi" id='usernameTip'>请使用用户名登录</div>
                	<div class="tip-error" id='usernameEmptyMsgDiv' style='display:none'>请输入用户名</div>
                </div>
            </div>
           
            <div class="shurukuang">
            	<span>密码：</span><input id='password' type='password' name='password' onkeydown='tryLogin()' value="" class="input2">
                <div class="tips-line">
                	<div class="tip-tishi" id='passTip'>请输入密码</div>
                	<div class="tip-error" id='passEmptyMsgDiv' style='display:none'>请输入密码</div>
                </div>
            </div>
			</form>
            <div class="shurukuang" style="margin-top:20px;">
            	<span>&nbsp;</span><button class="logintwz" id='loginBtn'></button>
            	<div class="tips-line"></div>
            </div>
        </div>    
	</div>
    <div class="logins">
    	 <div class="logintitles">没有帐号？</div>
         <div class="loginareas">
         <a href="/site/reg">>>点此注册</a>
         </div>
    </div>
</div>
<script>
$(function(){
	$('#loginBtn').click(function(){
        realLogin();
	});
});
function realLogin(){
    var usernameok = checkUsername();
    var passok = checkPass();
    if(usernameok && passok){
        $('#loginForm').submit();
    }
}
function tryLogin(){
    if (event.keyCode == 13){ realLogin();	}
}
function checkUsername(){
    if($('#username').val()==''){
        $('#usernameEmptyMsgDiv').show();
        $('#usernameTip').hide();
        return false;
    }else{
        $('#usernameEmptyMsgDiv').hide();
        $('#usernameTip').show();
        return true;
    }
}
function checkPass(){
    if($('#password').val()==''){
        $('#passEmptyMsgDiv').show();
        $('#passTip').hide();
        return false;
    }else{
        $('#passEmptyMsgDiv').hide();
        $('#passTip').show();
        return true;
    }
}
</script>
<{include file="footer.tpl"}>
